import React from 'react';
import PropTypes from 'proptypes';
import Checkbox from '@mui/material/Checkbox';
export default function CheckboxMe(props){
  // static propTypes = {
  //   name: PropTypes.string.isRequired,
  //   label: PropTypes.string.isRequired,
  //   disabled: PropTypes.bool,
  //   defaultChecked: PropTypes.bool,
  //   onChecked: PropTypes.func.isRequired,
  //   onUnchecked: PropTypes.func.isRequired,
  // };
  const onChange = () => {
    if (!props.defaultChecked) {
      props.onChecked();
    } else {
      props.onUnchecked();
    }
  };
    const { name, label, disabled } = props;
    return (
      <div>
        {label}
        <Checkbox
          label={label}
          name={name}
          disabled={disabled}
          checked={props.defaultChecked}
          onChange={onChange}
        />
      </div>
    );
}
